
export function showToast (configs) {
  const ecToast = this.$helper.get(window.$app || this, '$root.$children[0].$refs.ec-toast')
  if (ecToast) {
    ecToast.open(typeof configs === 'string' ? { title: configs } : configs)
  } else {
    console.log('未找到交互组件ec-toast -> showToast')
  }
}
export function hideToast () {
  const ecToast = this.$helper.get(window.$app || this, '$root.$children[0].$refs.ec-toast')
  if (ecToast) {
    ecToast.close()
  } else {
    console.log('未找到交互组件ec-toast -> hideToast')
  }
}

export function showLoading (configs) {
  setTimeout(() => {
    const ecLoading = this.$helper.get(window.$app || this, '$root.$children[0].$refs.ec-loading')
    if (ecLoading) {
      ecLoading.show(typeof configs === 'string' ? { title: configs } : configs)
    } else {
      console.log('未找到交互组件ec-loading -> showLoading')
    }
  }, 10)
}
export function hideLoading () {
  setTimeout(() => {
    const ecLoading = this.$helper.get(window.$app || this, '$root.$children[0].$refs.ec-loading')
    if (ecLoading) {
      ecLoading.hide()
    } else {
      console.log('未找到交互组件ec-loading -> hideLoading')
    }
  }, 11)
}
